#ifndef INPUT_HANDLER_H_INCLUDED
#define INPUT_HANDLER_H_INCLUDED

#include <SDL/SDL.h>
#include "Viewport.h"
#include "CurrentContext.h"
#include "Layer_List.h"
#include "Layer.h"
#include "Debug.h"

#define HOLDING 1

/**
 *\brief class for implement funciton for taking input
 *
 *Usea SDL_Event object to capture input events
 */
class Input_Handler
{
public:
    ///SDL event for handling input
    SDL_Event event;

    /// true if left key pressed
    bool leftPressed;

    ///true if right key is pressed
    bool rightPressed;

    ///true if up key is pressed
    bool upPressed;

    ///true if down key is pressed
    bool downPressed;

    int m_status;
	Sint16 m_x;
	Sint16 m_y;
	Sint16 m_lastx;
	Sint16 m_lasty;
    Layer_List &m_layerList;
    CurrentContext &m_currentCtx;
    Viewport &m_viewport;

    /**
     *\brief initializes input
     *
     *Sets all the key variables to false
     */
    void init();

    /**
     *\brief input handler loop
     *
     *Watch for key events and sets corresponding key to true on key-down
     *and false of key-up
     */

    void input_handler_start();

    static Input_Handler *get_instance();
    static void destroy();
protected:
       Input_Handler();
       static Input_Handler *instance;
};


#endif // INPUT_HANDLER_H_INCLUDED
